<%@page import="com.bean.RecordBean"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	@SuppressWarnings("unchecked")
	ArrayList<RecordBean> list = (ArrayList<RecordBean>)request.getAttribute("topList"); 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'statistic.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type = "text/css" href="CSS/statistic.css">
</head>

<body >
<div class="title">
	<h1>Top ten Instruments </h1>
	<table align="center">
	<tr  align="center" style="font-family: cursive;" height="30px">
	  <td>
		<a href="StatisticServlet?option=top">TOP 10</a>
		<font color="red"> |</font>		
		<a href="StatisticServlet?option=in">IN</a>
		<font color="red"> |</font>
		<a href="StatisticServlet?option=out">OUT</a>
		<font color="red"> |</font>
		<a href="StatisticServlet?option=tools">ALL Tools</a>
		<font color="red"> |</font>
		<a href="StatisticServlet?option=users">ALL Users </a>
	 </td>
	 <td width="15%" align="center" style="padding-top: 1px">
	 	<input type = "button" value = "SHEET" onclick="location.href='SheetServlet?sheet=top'">
	 </td>
	</tr></table>
</div>
<table width="70%" id="mytab"  border="1" class="t1">
  <thead>

  <tr>
    <th width="5%">num</th>
    <th width="30%">Instrument Name</th>
    <th width="20%">Bar-code</th>
    <th width="15%">Price</th>
    <th width="15%">Create Date</th>
    <th width="15%">Degree</th>
  </tr>
  </thead>
 <tbody style="overflow: scroll; height: 5px">
<%
	String insName = "";
	String barcode = "";
	String price = "";
	String date = "";
	String degree = "";
	int num=0;
	if(null != list && list.size()!=0)
	{
		Iterator<RecordBean> iter = list.iterator();
		while(iter.hasNext())
		{
			RecordBean rb = iter.next();
			insName = rb.getInsName();
			barcode = rb.getBarcode();
			price = rb.getPrice();
			date = rb.getCreateDate().toString();
			degree = String.valueOf(rb.getDegree());
			num++;
%>
  			<tr <%if(num%2!=0){ %>class="a1"<%} %>>
  			<td><%=num %></td>
  			<td><%=insName %></td>
   			<td><%=barcode %></td>
    		<td><%=price %></td>
   			<td><%=date %></td>
   			<td><%=degree %></td>
  			</tr>
<%	 	}
	}
%>
 </tbody>
</table>

</body>
</html>
